import { createRouter, createWebHistory } from 'vue-router'
import List from '../views/List.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/list',
      name: 'list',
      component: List
    },
    {
      path: '/cart',
      name: 'cart',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/Cart.vue')
    },{
      path:'/product/:id',
      name:'product',
      component: () => import('../views/Product.vue')
    },{
      path: '/:a*',
      redirect: '/list'
  }
  ]
})

export default router
